<?php

namespace App\Enums\Message;

use App\Traits\EnumTrait;

class InteractionMessageSceneEnum
{
    use EnumTrait;

    const TECHNOLOGY_COMMENT = ['scene' => 1, 'text' => '技能评论'];
    const TECHNOLOGY_COMMENT_REPLY = ['scene' => 2, 'text' => '技能评论回复'];
    const TECHNOLOGY_ORDER_COMMENT = ['scene' => 3, 'text' => '技能订单评价'];
    const COMMODITY_COMMENT = ['scene' => 4, 'text' => '宝物评论'];
    const COMMODITY_COMMENT_REPLY = ['scene' => 5, 'text' => '宝物评论回复'];
    const COMMODITY_ORDER_COMMENT = ['scene' => 6, 'text' => '宝物订单评价'];
    const MOMENT_COMMENT = ['scene' => 7, 'text' => '时光评论'];
    const MOMENT_COMMENT_REPLY = ['scene' => 8, 'text' => '时光评论回复'];

    public static array $sceneToText = [];

    public static function getScene($data)
    {
        return $data['scene'];
    }

    public static function getText($data)
    {
        return $data['text'];
    }

    public static function getTextByScene(int $scene)
    {
        if (empty(self::$sceneToText)) {
            self::$sceneToText = array_column(self::getConstants(), 'text', 'scene');
        }
        return self::$sceneToText[$scene];
    }
}
